﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FR.CodeVisualizer
{
    [Serializable]
    public class SQLQueryOptions
    {
        public string ConnectionString { get; set; }

        public string SQLCommand { get; set; }

        public string ExceptionMessage { get; set; }

        public bool IsQuery { get; set; }

        public void SetExceptionMessage(Exception ex)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(ex.Message);
            Exception innerEx = ex.InnerException;
            while (innerEx != null)
            {
                sb.AppendLine(innerEx.Message);
                innerEx = innerEx.InnerException;
            }

            this.ExceptionMessage = sb.ToString();
        }
    }
}
